I have a page displaying a price with .– instead of decimals .00:
<span id="product_price">123.–</span>
I am trying to switch its ending from ".–" to ".00" (or to nothing) in order to dynamically build the URL of a PayPal (unregistered) payment button, and cannot understand why Javascript's .replace() method fails replacing the .–.
Although the source code of the page shows the price is correctly written with the .– in the <span>, the console.log(amount); prints the amount with a - instead of the character entity:
var amount = jQuery("span#product_price").html();
console.log(amount);
amount = amount.toString(); // just to be sure
amount.replace('.–','.00');
Hence, I also tried
amount.replace('.-','.00');
and var amount = jQuery("span#product_price").html().replace('.–','.00');
Nothing works. What I'm doing wrong? Thanks.